import local from '@/utils/localStorage.js';
const BASE_URL = 'http://localhost:8080'//接口地址
export const myRequest = (options) => {
	return new Promise((reslove, reject) => {
		uni.request({
			url: BASE_URL + options.url,
			method: options.method || 'GET',
			data: options.data || {},
			header: {
			    'contentType': "application/json;charset=UTF-8",
				'Accept': "application/json;charset=UTF-8",
				'token': local.get("token").v,
			},
			success: (res) => {
				// if (res.data.code != 200) {
				// 	return uni.showToast({
				// 		title: "数据获取失败"
				// 	})
				// }
				reslove(res)
			},
			fail:(err)=> {
				uni.showToast({
					title: "请求接口失败"
				})
				reject(err)
			}
		})
	})
}